<?php

namespace Plugin\Attractions\HaiKang\Process;

use Common\Common;
use Hyperf\Coroutine\Coroutine;
use Hyperf\Di\Annotation\Inject;
use Hyperf\Process\AbstractProcess;
use Hyperf\Process\Annotation\Process;
use Plugin\Attractions\HaiKang\Common\HKAPI;
use Plugin\Attractions\HaiKang\Repository\DeviceGroupRepository;
use Plugin\Attractions\HaiKang\Service\HKDeviceService;

/**
 * 海康设备分组拉取
 */
#[Process(name: "SycHKDeviceGroup")]
class SycHKDeviceGroup extends AbstractProcess
{
    #[Inject()]
    private HKDeviceService $service;

    public function handle(): void
    {
        Coroutine::create(function () {
            while (true) {
                $this->service->syncGroups();
                Coroutine::sleep(3600);
            }
        });
    }

    public function isEnable($server): bool
    {
        return false;
    }
}
